home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 November / EnigmA AMIGA RUN 02 (1995)(G.R. Edizioni)(IT)[!][issue 1995-11][Skylink CD].iso / earcd / guide / html-hea.lha / ARexx / HTML-CEd.rexx < prev    next >
OS/2 REXX Batch file  |  1995-09-05  |  2KB  |  68 lines

  1.  /*
  2.   ** HTML.rexx
  3.   **
  4.   ** $VER: HTML.rexx 2.0.0 (29 August 95)
  5.   **
  6.   ** This script inserts HTML-Heaven codes into the CED document. If no 
  7.   ** block is currently defined, the skeleton code is inserted.  If a block
  8.   ** IS defined, though, this script will sandwhich the block between the 
  9.   ** HTML codes.  
  10.   **
  11.   ** This script requires CygnusEd Professional v3.5 (or later) to run as
  12.   ** well as HTML-Heaven.
  13.   **
  14.   ** Copyright 1995 Douglas R. Cootey (bug@itsnet.com)
  15.   ** Modifications by Paul Kolenbrander (paul@serena.iaehv.nl)
  16.   */
  17.  
  18. OPTIONS RESULTS                             
  19. PARSE ARG HTMLCMD
  20.  
  21. /* Addressing the default CygnusEd port.  Change if necessary. */
  22. ADDRESS 'rexx_ced'
  23.  
  24. /* First we strip the leading and trailing "'s as CEd doesn't like these. */
  25. HTMLCMD = SUBSTR(HTMLCMD, 2, LENGTH(HTMLCMD) - 2) 
  26.  
  27. /* Now we separate the codes into the front and back variables if needed */
  28. IF POS('><',HTMLCMD) ~= 0 THEN DO         /* Is it a split command? */
  29.    CMD2 = right(HTMLCMD,(LENGTH(HTMLCMD)-(LASTPOS('<',HTMLCMD))+1))
  30.    CMD1 = substr(HTMLCMD,1,(LENGTH(HTMLCMD)-LENGTH(CMD2)))
  31. END
  32.  
  33. /* Let's not play with the standard clip unit */
  34. UnusedClipUnit 
  35. /* CygnusEd checks to see if there is a highlighted block of text */
  36. STATUS BLOCKY
  37. IF (RESULT = -1) THEN DO
  38.    CEDTOFRONT
  39.    TEXT HTMLCMD /*Plops the skeleton text right where the cursor is! */
  40.    EXIT 0
  41. END
  42.  
  43. /* Since we're not using the standard clip unit, let's save the standard clipping before we start cutting */
  44. STATUS CLIPUNIT
  45. OldClipUnit 
  46. /* Now we're using our clip unit.  */
  47. SET CLIPBOARD UNIT UnusedClipUnit
  48.  
  49. /* Snippity Snip! */
  50. CUT
  51. IF (RESULT ~= 1) THEN DO
  52.    CEDTOFRONT
  53.    OKAY1 "Error deleting block"
  54. END
  55. /* Plop in the front part of the HTML code...*/
  56. TEXT CMD1 
  57.  
  58. /* Repaste the highlighted text...*/
  59. PASTE
  60.  
  61. /* Tack on the ending HTML code! */
  62. TEXT CMD2
  63.  
  64. /* Now let's tell CygnusEd to use the old clipping again */
  65. SET CLIPBOARD UNIT OldClipUnit
  66.  
  67. EXIT 0
  68.